﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GeneratorLib.DB;
using GeneratorLib.DB.Connectios;
using GeneratorLib.DB.Schemas;
using Pasys.PresentationCore;

namespace Generator.Generators
{
    public partial class MVCListModel : GeneratorCodeBase
    {
        //private
        //private ICommandBusService commandBus;

        //public IConnection Connection { get; set; }
        //private TableInfo _table;
        //public TableInfo Table
        //{
        //    get
        //    {
        //        return _table;
        //    }
        //    set
        //    {
        //        _table = value;
        //        if (value != null)
        //        {
        //            this.Text = string.Format("{0}", value.TableName);
        //        }
        //    }
        //}

        //public void AddToolStripItem(ToolStripItem item)
        //{

        //}

        //public string GeneratorName { get; set; }

        public MVCListModel()
        {
            InitializeComponent();
            this.GeneratorName = "MVC ListModel Generator";
            AddToolItems();
        }

        private void AddToolItems()
        {
            ToolStripMenuItem item3 = new ToolStripMenuItem("ListModel"){Tag = 3};
            ToolStripMenuItem item4 = new ToolStripMenuItem("ListRepository"){Tag = 4};
            ToolStripMenuItem item5 = new ToolStripMenuItem("ListRepository") { Tag = 5 };

            this.AddToolStripItem(item3);
            this.AddToolStripItem(item4);
            this.AddToolStripItem(item5);
        }




        public override void Generate()
        {
            base.Generate();
        }

        public override void Generate(ToolStripItem item)
        {
            base.Generate(item);

            //this.Table = MYSQLUtility.GetTableInfo(this.Connection, this.Table.TableName);
            txtCode.ResetText();
            CodeBuilder.Clear();
            AppendUsing();
            AppendNameSpaceStart();

            switch (Convert.ToInt32(item.Tag))
            {
                case 3:
                    CreateListModel();
                    break;
                case 4:
                    CreateListRepository();
                    break;
                case 5:
                    CreateListModel();
                    CreateListRepository();
                    break;

                default:
                    break;
            }
            AppendNameSpaceEnd();

            txtCode.Text = CodeBuilder.ToString();
            txtCode.Refresh();
        }

        private void CreateListModel()
        {

            //AppendUsing();
            //AppendNameSpaceStart();
            CreateListModelPart01();
            CreateListModelPart02();
            //AppendNameSpaceEnd();

        }

        private void CreateListModelPart01()
        {

            var res = from s in this.Connection.Relations
                      where
                          s.ForeignTable.TableName.ToLower().CompareTo(this.Table.TableName.ToLower()) == 0
                      select s;


            TableInfoAddin tableAddin = this.Connection.FindTableAddin(this.Table.TableName);

            AppandClassStart(this.Table.ModelListName, "", string.Format("{0}リストModelデータ",tableAddin.TableDisplayName));
            CodeBuilder.AppendLine("        public int RowNum { get; set; }");

            int index = 0;
            foreach (FieldInfo field in Table.Fields)
            {
                index++;
                if (!tableAddin.IsListField(field.FieldName))
                    continue;

                FieldInfoAddin addin = tableAddin.FindFieldAddin(field.FieldName);

                CodeBuilder.AppendLine("        /// <summary>");
                if (addin != null)
                    CodeBuilder.AppendLine("        /// {0}", addin.DisplayName);
                CodeBuilder.AppendLine("        /// </summary>");
                if (addin != null)
                    CodeBuilder.AppendLine("        [Display(Name = \"{0}\")]", addin.GetDisplay());
                                
                CodeBuilder.AppendLine("        {0}", getSingleDeclare(field));
            }

            //relations table's field
            index = 0;
            foreach (var r in res)
            {
                index++;
                if (!tableAddin.IsListField(r.ForeignTable.KeyFieldName))
                    continue;

                TableInfo tTable = this.Connection.FindTable(r.PrimaryTable.TableName);
                TableInfoAddin tAddin = this.Connection.FindTableAddin(r.PrimaryTable.TableName);
                FieldInfo tField = tTable.FindField(r.PrimaryTable.ValueFieldName);
                FieldInfoAddin tFileAddIn = tAddin.FindFieldAddin(r.PrimaryTable.ValueFieldName);

                CodeBuilder.AppendLine("        /// <summary>");
                if (tFileAddIn != null)
                    CodeBuilder.AppendLine("        /// {0}", tFileAddIn.DisplayName);
                CodeBuilder.AppendLine("        /// </summary>");
                if (tFileAddIn != null)
                    CodeBuilder.AppendLine("        [Display(Name = \"{0}\")]", tFileAddIn.GetDisplay());
                CodeBuilder.AppendLine("        {0}", getSingleDeclare(tField));

            }

            //codeBuilder.AppendLine("");
            //codeBuilder.AppendLine("        public string btnName { get; set; }");

            AppandClassEnd();
        
        }

        private void CreateListModelPart02()
        {

            var res = from s in this.Connection.Relations
                      where
                          s.ForeignTable.TableName.ToLower().CompareTo(this.Table.TableName.ToLower()) == 0
                      select s;


            TableInfoAddin tableAddin = this.Connection.FindTableAddin(this.Table.TableName);
            CodeBuilder.AppendLine("");
            AppandClassStart(this.Table.ModelListSearchName, "", string.Format("{0}検索Modelデータ", tableAddin.TableDisplayName));

            int index = 0;
            foreach (FieldInfo field in Table.Fields)
            {
                index++;
                if (!tableAddin.IsSearchField(field.FieldName))
                    continue;

                FieldInfoAddin addin = tableAddin.FindFieldAddin(field.FieldName);

                CodeBuilder.AppendLine("        /// <summary>");
                if (addin != null)
                    CodeBuilder.AppendLine("        /// {0}", addin.DisplayName);
                CodeBuilder.AppendLine("        /// </summary>");
                if (addin != null)
                    CodeBuilder.AppendLine("        [Display(Name = \"{0}\")]", addin.GetDisplay());

                CodeBuilder.AppendLine("        {0}", getSingleDeclareForSearchModel(field));
            }

            //List
            foreach (var r in res)
            {
                TableInfo t = Connection.FindTable(r.PrimaryTable.TableName);
                TableInfoAddin tAddin = this.Connection.FindTableAddin(r.PrimaryTable.TableName);
                FieldInfoAddin addin = tAddin.FindFieldAddin(r.PrimaryTable.ValueFieldName);

                if (tableAddin.IsSearchField(r.ForeignTable.KeyFieldName))
                {

                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("        //{0}リスト",  tAddin.TableDisplayName );
                    CodeBuilder.AppendLine("        private List<SelectListItem> _{0};  ", t.EntityListName);
                    CodeBuilder.AppendLine("        public List<SelectListItem> {0}", t.EntityListName);
                    CodeBuilder.AppendLine("        {{");
                    CodeBuilder.AppendLine("            get");
                    CodeBuilder.AppendLine("            {{");
                    CodeBuilder.AppendLine("                if (_{0} == null)", t.EntityListName);
                    CodeBuilder.AppendLine("                    _FillModelListData_{0}();",t.EntityName);
                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("                return _{0};",t.EntityListName);
                    CodeBuilder.AppendLine("            }}");
                    CodeBuilder.AppendLine("        }}");

                    //codeBuilder.AppendLine("        public List<SelectListItem> {0} {{ get; set; }}", t.EntityListName);
                }
            }



            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("        public string btnName { get; set; }");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("        public int[] OrderList {{ get; set; }}");

                        //List
            foreach (var r in res)
            {
                TableInfo t = Connection.FindTable(r.PrimaryTable.TableName);
                TableInfoAddin tAddin = this.Connection.FindTableAddin(r.PrimaryTable.TableName);
                FieldInfoAddin addin = tAddin.FindFieldAddin(r.PrimaryTable.ValueFieldName);

                if (tableAddin.IsSearchField(r.ForeignTable.KeyFieldName))
                {

                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("        /// <summary>");
                    CodeBuilder.AppendLine("        /// {0}リストデータの取得",tAddin.TableDisplayName);
                    CodeBuilder.AppendLine("        /// </summary>");
                    CodeBuilder.AppendLine("        private  void _FillModelListData_{0}()",t.EntityName);
                    CodeBuilder.AppendLine("        {{");
                    CodeBuilder.AppendLine("            CommunicationCapsule inParam = new CommunicationCapsule();");
                    CodeBuilder.AppendLine("            CommunicationCapsule outParam;");
                    CodeBuilder.AppendLine("            CommunicationHelper commHelper = new CommunicationHelper();");
                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("            inParam.Param[\"{0}\"] = 0;",t.GetKeyField().FieldName);
                    CodeBuilder.AppendLine("            inParam.Param[\"{0}\"] = string.Empty; ;",t.GetDisplayValueField().FieldName);
                    CodeBuilder.AppendLine("            commHelper.Execute(CommunicationID.Core, \"{0}ItemValueText\", inParam, out outParam);",t.EntityName);
                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("            _{0} = new List<SelectListItem>();",t.EntityListName);
                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("            _{0}.Add(new SelectListItem()", t.EntityListName);
                    CodeBuilder.AppendLine("            {{");
                    CodeBuilder.AppendLine("                Text = \"\",");
                    CodeBuilder.AppendLine("                Value = \"0\"");
                    CodeBuilder.AppendLine("            }});");
                    CodeBuilder.AppendLine("");
                    CodeBuilder.AppendLine("            foreach (Dictionary<string, object> dic in outParam.ListParam)");
                    CodeBuilder.AppendLine("            {{");
                    CodeBuilder.AppendLine("                _{0}.Add(new SelectListItem()", t.EntityListName);
                    CodeBuilder.AppendLine("                {{");
                    CodeBuilder.AppendLine("                    Text = Converts.ToTryString(dic[\"{0}\"]),",t.GetDisplayValueField().FieldName);
                    CodeBuilder.AppendLine("                    Value = Converts.ToTryString(dic[\"{0}\"])",t.GetKeyField().FieldName);
                    CodeBuilder.AppendLine("                }});");
                    CodeBuilder.AppendLine("            }}           ");
                    CodeBuilder.AppendLine("        }}");

                }
            }


            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("        /// <summary>");
            CodeBuilder.AppendLine("        /// DisplayNo");
            CodeBuilder.AppendLine("        /// </summary>");
            CodeBuilder.AppendLine("        public IEnumerable<SelectListItem> Items");
            CodeBuilder.AppendLine("        {{");
            CodeBuilder.AppendLine("            get");
            CodeBuilder.AppendLine("            {{");
            CodeBuilder.AppendLine("                {0} search = new {0}();",this.Table.ModelListSearchName);
            CodeBuilder.AppendLine("                List<{0}> items = {1}.SearchData(search);",this.Table.EntityListName,this.Table.ModelListRepositoryName);
            CodeBuilder.AppendLine("                List<SelectListItem> ret = new List<SelectListItem>();");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("                foreach (var item in items)");
            CodeBuilder.AppendLine("                {{");
            CodeBuilder.AppendLine("                    ret.Add(new SelectListItem()");
            CodeBuilder.AppendLine("                    {{");
            CodeBuilder.AppendLine("                        Value = Converts.ToTryString(item.{0}),",this.Table.GetKeyField().FieldName);
            CodeBuilder.AppendLine("                        Text = item.{0}",this.Table.GetDisplayValueField().FieldName);
            CodeBuilder.AppendLine("                    }});");
            CodeBuilder.AppendLine("                }}");
            CodeBuilder.AppendLine("                return ret;");
            CodeBuilder.AppendLine("            }}");
            CodeBuilder.AppendLine("        }}");


            AppandClassEnd();

        }

       
        private void CreateListRepository()
        {
            TableInfoAddin tableAddin = this.Connection.FindTableAddin(this.Table.TableName);
            //AppendUsing();
            //AppendNameSpaceStart();
            AppandClassStart(this.Table.ModelListRepositoryName, "", string.Format("{0}データリポジトリ", tableAddin.TableDisplayName));
            CreateListRepository01();
            if (!this.Table.IsMasterTable)
                CodeBuilder.AppendLine("        /*");
            CreateListRepository02();
            if (!this.Table.IsMasterTable)
                CodeBuilder.AppendLine("        */");
            
            AppandClassEnd();
            //AppendNameSpaceEnd();

        }
        private void CreateListRepository01()
        {

            var res = from s in this.Connection.Relations
                      where
                          s.ForeignTable.TableName.ToLower().CompareTo(this.Table.TableName.ToLower()) == 0
                      select s;


            TableInfoAddin tableAddin = this.Connection.FindTableAddin(this.Table.TableName);

            int index = 0;

            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("        public static List<{0}> SearchData({1} search)", this.Table.ModelListName, this.Table.ModelListSearchName);
            CodeBuilder.AppendLine("        {");
            CodeBuilder.AppendLine("            List<{0}> listData = new List<{0}>();",this.Table.ModelListName);
            CodeBuilder.AppendLine("            CommunicationCapsule inParam = new CommunicationCapsule();");
            CodeBuilder.AppendLine("            CommunicationCapsule outParam;");
            CodeBuilder.AppendLine("            CommunicationHelper commHelper = new CommunicationHelper();");
            CodeBuilder.AppendLine("");
            
            index = 0;
            foreach (var fieldName in tableAddin.SearchFields)
            {
                index++;
                FieldInfo field = this.Table.FindField(fieldName);
                CodeBuilder.AppendLine("            inParam.Param[\"{0}\"] ={1};", field.FieldName, getSingleConvertForSearchModel(field," search.{0}"));
            }

            //codeBuilder.AppendLine("            inParam.Param[\"{0}\"] = search.{0};", this.Table.GetKeyField());
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            commHelper.Execute(CommunicationID.Core, \"{0}ListSelect\", inParam, out outParam);",this.Table.EntityName);
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            int _rowNum = 1;");
            CodeBuilder.AppendLine("            foreach (Dictionary<string, object> item in outParam.ListParam)");
            CodeBuilder.AppendLine("            {");
            CodeBuilder.AppendLine("                {0} data = new {0}",this.Table.ModelListName);
            CodeBuilder.AppendLine("                {");
            CodeBuilder.AppendLine("                    RowNum = _rowNum++,");

            index = 0;
            List<FieldInfo> listFields = new List<FieldInfo>();
            foreach (var field in this.Table.Fields)
            {
                index++;
                if (tableAddin.IsListField(field.FieldName))
                    listFields.Add(field);
            }

            index = 0;
            foreach (var r in res)
            {
                index++;
                if (!tableAddin.IsListField(r.ForeignTable.KeyFieldName))
                    continue;

                TableInfo tTable = this.Connection.FindTable(r.PrimaryTable.TableName);
                FieldInfo tField = tTable.FindField(r.PrimaryTable.ValueFieldName);
                listFields.Add(tField);
            }


            index = 0;
            foreach (var field in listFields)
            {
                index++;
                if (index < listFields.Count)
                    CodeBuilder.AppendLine("                    {0} = {1},", field.FieldName, getSingleConvert(field, "item[\"{0}\"]"));
                else
                    CodeBuilder.AppendLine("                    {0} = {1} ", field.FieldName, getSingleConvert(field, "item[\"{0}\"]"));
            }
            CodeBuilder.AppendLine("                };");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("                listData.Add(data);");
            CodeBuilder.AppendLine("            }");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            return listData;");
            CodeBuilder.AppendLine("        }}");

        }

        private void CreateListRepository02()
        {
            TableInfoAddin tableAddin = this.Connection.FindTableAddin(this.Table.TableName);
            FieldInfo keyField = this.Table.GetKeyField();

            CodeBuilder.AppendLine("        /// <summary>");
            CodeBuilder.AppendLine("        /// {0}の更新処理",tableAddin.TableDisplayName);
            CodeBuilder.AppendLine("        /// </summary>");
            CodeBuilder.AppendLine("        /// <param name=\"search\"></param>");
            CodeBuilder.AppendLine("        /// <param name=\"sourceItems\"></param>");
            CodeBuilder.AppendLine("        /// <param name=\"session\"></param>");
            CodeBuilder.AppendLine("        public static void UpdateOrder({0} search,string sourceItems, HttpSessionStateBase session)", this.Table.ModelListSearchName);
            CodeBuilder.AppendLine("        {{");
            CodeBuilder.AppendLine("            string source = sourceItems;");
            CodeBuilder.AppendLine("            string[] items = source.Split(new string[] {{ \"-DelimiterOfLine-\" }}, StringSplitOptions.RemoveEmptyEntries);");
            CodeBuilder.AppendLine("            Dictionary<int, string> work = new Dictionary<int, string>();");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            // 取得したデータの切り離し");
            CodeBuilder.AppendLine("            foreach (string keyValue in items)");
            CodeBuilder.AppendLine("            {{");
            CodeBuilder.AppendLine("                string[] temp = keyValue.Split(new string[] {{ \"-DelimiterOfKeyValue-\" }}, StringSplitOptions.RemoveEmptyEntries);");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("                // key value set");
            CodeBuilder.AppendLine("                work.Add(Converts.ToTryInt(temp[0]), temp[1]);");
            CodeBuilder.AppendLine("            }}");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            // 現在のデータとの比較");
            CodeBuilder.AppendLine("            List<{0}> lists = SearchData(search);",this.Table.EntityListName);
            CodeBuilder.AppendLine("            List<Dictionary<string, object>> update = new List<Dictionary<string, object>>();");
            CodeBuilder.AppendLine("            int currentOrder = 1;");
            CodeBuilder.AppendLine("            foreach (KeyValuePair<int, string> item in work)");
            CodeBuilder.AppendLine("            {{");
            CodeBuilder.AppendLine("                for (int i = 0; i < lists.Count; i++)");
            CodeBuilder.AppendLine("                {{");
            CodeBuilder.AppendLine("                    if (lists[i].{0} == item.Key && lists[i].DisplayNo != currentOrder)", keyField.FieldName);
            CodeBuilder.AppendLine("                    {{");
            CodeBuilder.AppendLine("                        // 順番が変更された");
            CodeBuilder.AppendLine("                        Dictionary<string, object> param = new Dictionary<string, object>()");
            CodeBuilder.AppendLine("                        {{");
            int index = 0;
            List<FieldInfo> listFields = new List<FieldInfo>();
            foreach (var field in this.Table.Fields)
            {
                index++;
                if (tableAddin.IsListField(field.FieldName))
                    listFields.Add(field);
            }
            index = 0;
            foreach (var field in listFields)
            {
                index++;
                if (field.FieldName.CompareTo("DisplayNo") == 0)
                { 
                    //codeBuilder.AppendLine("                            {{\"DisplayNo\",currentOrder}},");
                }
                else if (field.FieldName.CompareTo("DisplayFlag") == 0)
                {
                    //codeBuilder.AppendLine("                            {{\"DisplayFlag\",lists[i].DisplayFlag==\"○\"?true:false}},");
                }
                else if (field.FieldName.CompareTo("LastUpdateTime") == 0)
                {
                    //codeBuilder.AppendLine("                            {{\"LastUpdateTime\",DateTime.Now}},");
                }
                else if (field.FieldName.CompareTo("UpdateFlag") == 0)
                {
                    //codeBuilder.AppendLine("                            {{\"UpdateFlag\",true}},");
                }
                else
                {
                    CodeBuilder.AppendLine("                            {{\"{0}\",lists[i].{0}}},", field.FieldName);
                }
            }

            CodeBuilder.AppendLine("                            {{\"DisplayNo\",currentOrder}},");
            CodeBuilder.AppendLine("                            {{\"DisplayFlag\",lists[i].DisplayFlag}},");
            CodeBuilder.AppendLine("                            {{\"LastUpdateTime\",DateTime.Now}},");
            CodeBuilder.AppendLine("                            {{\"UpdateFlag\",true}},");

            CodeBuilder.AppendLine("                        }};");
            CodeBuilder.AppendLine("                        update.Add(param);");
            CodeBuilder.AppendLine("                    }}");
            CodeBuilder.AppendLine("                }}");
            CodeBuilder.AppendLine("                currentOrder++;");
            CodeBuilder.AppendLine("            }}");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            CommunicationCapsule inParam = new CommunicationCapsule();");
            CodeBuilder.AppendLine("            CommunicationCapsule outParam;");
            CodeBuilder.AppendLine("            CommunicationHelper commHelper = new CommunicationHelper();");
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("            inParam.ListParam = update;");
            CodeBuilder.AppendLine("            commHelper.Execute(CommunicationID.Core, \"{0}ListUpdate\", inParam, out outParam);",this.Table.EntityName);
            CodeBuilder.AppendLine("        }}");

        }





        private string getSingleDeclare(FieldInfo field)
        {
            return string.Format("public {0} {1} {{get;set;}}", field.FieldType.MapName, field.FieldName);
        }

        private string getSingleDeclareForSearchModel(FieldInfo field)
        {
            string type = field.FieldType.MapName;
            if (field.Nullabled && type.ToLower().CompareTo("datetime") == 0)
                type = "string";

            return string.Format("public {0} {1} {{get;set;}}", type, field.FieldName);
        }

        /// <summary>
        /// declare variable and get value from InParam.Param
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        private string getSingleConvert(FieldInfo field, string format)
        {
            //Converts.ToTryInt({0},0)
            string method = GeneratorCode.Pasys.Converts.ConvertsMethodName(field);
            string fName = string.Format(format, field.FieldName);
            return string.Format(method, fName);
        }

        private string getSingleConvertForSearchModel(FieldInfo field, string format)
        {
            string method = GeneratorCode.Pasys.Converts.ConvertsMethodName(field, true);
            string fName = string.Format(format, field.FieldName);
            return string.Format(method, fName);
        }

        protected override void AppendUsing()
        {
            CodeBuilder.AppendLine("using System;");
            CodeBuilder.AppendLine("using System.Collections.Generic;");
            CodeBuilder.AppendLine("using System.ComponentModel.DataAnnotations;");
            CodeBuilder.AppendLine("using System.Linq;");
            CodeBuilder.AppendLine("using System.Web;");
            CodeBuilder.AppendLine("using System.Web.Mvc;");
            CodeBuilder.AppendLine("using System.Web.Configuration;");
            CodeBuilder.AppendLine("using PacificSystem.CommunicationLibrary;");
            CodeBuilder.AppendLine("using PacificSystem.ConstantLibrary;");
            //CodeBuilder.AppendLine("using PacificSystem.ConstantLibrary.Sessions;");
            CodeBuilder.AppendLine("using PacificSystem.Utility;");
        }
        protected override void AppandClassStart(string classAdditional, string baseClassName, string functionDesc)
        {
            CodeBuilder.AppendLine("    /// <summary>");
            CodeBuilder.AppendLine("    ///{0}", functionDesc); // 
            CodeBuilder.AppendLine("    /// </summary>");
            if (baseClassName.Trim().Length > 0)
            {
                CodeBuilder.AppendLine("    public class {0}{1}:{2} ", "", classAdditional, baseClassName);
            }
            else
            {
                CodeBuilder.AppendLine("    public class {0}{1} ", "", classAdditional);
            }
            SaveFileName = string.Format("{0}{1}", "", classAdditional);
            CodeBuilder.AppendLine("    {");

        }

        protected override void AppendNameSpaceStart()
        {
            CodeBuilder.AppendLine("");
            CodeBuilder.AppendLine("namespace MvcApplication.Models");
            CodeBuilder.AppendLine("{");
        }



    }
}
